package com.ruoyi.DataManage.mapper;

import java.util.List;
import com.ruoyi.DataManage.domain.Subject_tree;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 学科专业统计Mapper接口
 * 
 * @author CehnFneg
 * @date 2024-04-22
 */
@Mapper
public interface Subject_treeMapper 
{
    /**
     * 查询学科专业统计
     * 
     * @param id 学科专业统计主键
     * @return 学科专业统计
     */
    public Subject_tree selectSubject_treeById(Long id);

    /**
     * 查询学科专业统计列表
     * 
     * @param subject_tree 学科专业统计
     * @return 学科专业统计集合
     */
    public List<Subject_tree> selectSubject_treeList(Subject_tree subject_tree);

    /**
     * 新增学科专业统计
     * 
     * @param subject_tree 学科专业统计
     * @return 结果
     */
    public int insertSubject_tree(Subject_tree subject_tree);

    /**
     * 修改学科专业统计
     * 
     * @param subject_tree 学科专业统计
     * @return 结果
     */
    public int updateSubject_tree(Subject_tree subject_tree);

    /**
     * 删除学科专业统计
     * 
     * @param id 学科专业统计主键
     * @return 结果
     */
    public int deleteSubject_treeById(Long id);

    /**
     * 批量删除学科专业统计
     * 
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteSubject_treeByIds(Long[] ids);

    @Select("select id from subject_tree where parent_id = #{id}")
    Long[] selectSubject_treeListByParentId(long id);

    List<Subject_tree> getMajorListByUniversityId(Long universityId);


    public List<Subject_tree> getSubjectList(@Param("categoryIds")List<Long> categoryIds);


    List<Subject_tree> getAllSubjectList();

    List<Subject_tree> getMajorListByParentId(Long subjectId);

    @Select("select parent_id from subject_tree where id = #{majorId}")
    Long getParentIdByMajorId(Long majorId);

    @Select("select category_id from subject_tree where id = #{subjectId}")
    Long getCategoryIdBySubjectId(Long subjectId);

    @Select("select id from subject_tree where name = #{subjectName}")
    List<Long> selectIdsByName(String subjectName);

    List<Subject_tree> getMajorListByParentIds(@Param("ids") List<Long> ids);

    List<Subject_tree> getSubjectListByCategoryId(Long categoryId);
}
